#define _CRT_SECURE_NO_WARNINGS	

#include<stdio.h>

int main()
{
    int x;
    scanf("%d", &x);
    int a, b, c, max, min, sum;
    if (x < 10)
        printf("%d", x * 100);
    else if (x > 99)
    {
        a = x % 10;
        b = x / 100;
        c = x / 10 % 10;
        sum = a + b + c;
        max = (a > b) ? a : b;
        max = (max > c) ? max : c;
        min = (a < b) ? a : b;
        min = (min < c) ? min : c;
        int mid = sum - max - min;
        printf("%d", max * 100 + mid * 10 + min);
    }
    else
    {
        a = x % 10;
        c = x / 10 % 10;
        int sum = a + c;
        max = (a > c) ? a : c;
        min = sum - max;
        printf("%d", max * 100 + min * 10);
    }
    return 0;
}